package com.wpp.controller;

import com.wpp.client.RPCConsumer;
import com.wpp.service.IUserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test")
public class TestController {


    @Resource
    private RPCConsumer rpcConsumer;

    @RequestMapping("/say")
    public String say() throws InterruptedException {
        IUserService iUserService = (IUserService) rpcConsumer.createProxy(IUserService.class);

        String result = iUserService.sayHello("hello world");
        System.out.println(result);
//        Thread.sleep(2000);
       return result;
    }
}
